﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.IO;

public partial class ShowPage : System.Web.UI.Page
{

    public string PageUrl { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        foreach (string key in Request.QueryString)
        {
            switch (key.ToLower())
            {
                case "pageurl": this.PageUrl = Request.QueryString[key]; break;
            }
        }
        string requestString = "http://news.google.com";
        HttpWebResponse resultResponse;
        HttpWebRequest searchWebRequest = (HttpWebRequest)HttpWebRequest.Create(requestString);
        resultResponse = (HttpWebResponse)searchWebRequest.GetResponse();

        //if (resultResponse.CharacterSet == "windows-1251") 
        Encoding enc = Encoding.UTF8;
        if (resultResponse.ContentEncoding != string.Empty)
        {
            enc = Encoding.GetEncoding(resultResponse.ContentEncoding);
        }
        StreamReader reader = new StreamReader(resultResponse.GetResponseStream(), enc);
        string HtmlResult;
        HtmlResult = reader.ReadToEnd();
        OriginalPageLiteral.Mode = LiteralMode.PassThrough;
        OriginalPageLiteral.Text = HtmlResult;


    }
}
